#ifndef STRINGUTIL_H
# define STRINGUTIL_H

#include "core.h"

#define convChars(s) (char*)s
typedef char*(*convChars)(char*);

char *createBufferCopy(const char *buffer);

// Line Has Value
bool LineHasValue(const char *buffer, const char *value);
bool LineStartWith(char *buffer, char *value);
bool LineEqual(const char *buffer, const char *value);
bool LineIsEmpty(const char *buffer);
char* LineTrim(char *buffer);
bool LineTrim_buf(char *buffer, char *dest);
bool LineTrimIsEmpty(char *buffer);

GSList* split(const char *buf, char value);
GSList* split_cnt(const char *buf, char value, int cnt);
GSList* splits(const char *buf, const char *value);

char * LineReplace(const char *buf, const char *old, const char *replace);
// bool LineReplace_buf(char *buf, const char *old, const char *replace);

bool splitToString(GSList *list, char *buffer);
bool splitToStringWithTrim(GSList *list, char *buffer);
bool splitToStringWithSeparator(GSList *list, const char *sep, char *buffer);

void printf_iterator(gpointer item, gpointer prefix);
bool isNull(const char *str);


#endif